|
|
|
|
|
|
|
Figure 1.18.
Adding the ImageCombo and ImageList
controls to the demo form. |
|
|
|
|
|
|
|
|
Note The ImageCombo control is included in the Windows Common Controls 6.0 (MSCOMCTL.OCX) |
|
|
|
|
|
|
|
|
|
Before setting up the ImageCombo control, you should add the three pictures you want to the ImageList control. Once that is done, you are ready to work with the ImageCombo control. To add a new item to an ImageCombo, you would use the Add method to create a new ComboItem object in the ComboItems collection. The syntax of the Add method is as follows: |
|
|
|
|
|
|
|
|
ImageCombo1.ComboItems (Index, Key, Text, Image, SelImage, OverlayImage, _ Indent) |
|
|
|
|
|
|
|
|
As you can see, you can supply optional arguments to the Add method specifying many of the properties of the new item, including its Index and Key values, any pictures it will use, and the level of indentation it will have. |
|
|
|
|
|
|
|
|
To see how this works, add the following code to the demo's Form_Load routine. |
|
|
|
|
|
|
|
|
Dim objNewItem As ComboItem
Set objNewItem = ImageCombo1.ComboItems.Add(1,Book1,Teach Yourself _ VB5,1)
Set objNewItem = ImageCombo1.ComboItems.Add(2,Book1,Teach Yourself More _ VB5,2)
Set objNewItem = ImageCombo1.ComboItems.Add(3,Book1,Teach Yourself _ VB6,3) |
|
|
|
|
|
|
|
|
The preceding code will add three items to the ImageCombo control. Each of these items will appear with its own unique image next to it in the list portion of the control (see Figure 1.19). The images used were added to the Image control that was placed on the form. |
|
|
|
|
|